<?php
	include_once("DataProvider.php");
	include_once("../DTO/loaiSPDTO.php");
	
	class loaiSPDAO
	{
		public $sql = "";
		var $loaiSPDTO;
		function __construct()
		{
			return $this->loaiSPDTO = new loaiSPDTO();
		}
		
		public function load()
		{
			$result= DataProvider::ExecuteQuery($this->sql);
			$arrLoaiSPDTO = new ArrayObject();
			
			while($row = mysql_fetch_array($result))
			{
				$loaiSPDTO = new loaiSPDTO();
				$loaiSPDTO->idLoaiSP = $row['idLoaiSP'];
				$loaiSPDTO->tenLoaiSP = $row['tenLoaiSP'];
				$loaiSPDTO->biXoa = $row['biXoa'];
				
				$arrLoaiSPDTO[] = $loaiSPDTO;
			}
			return $arrLoaiSPDTO;
		}
		
		public function load_LoaiSP_All()
		{
			$this->sql= 'select * from loaisp';
			$result=$this->load();
			return $result; 
		}
		
		public function load_LoaiSP_One($idLoaiSP)
		{
			$this->sql = 'select * from loaisp where idLoaiSP ='.$idLoaiSP;
			$result = $this->load();
			return $result;
		}
		
		public function load_LoaiSP()
		{
			$this->sql = 'select * from loaisp where biXoa=0';
			$result = $this->load();
			return $result;
		}
		
		
	}
	
?>